<template>
    <el-row>
      <el-col :span="2">
        <div class="grid-content bg-purple-dark">&emsp;</div>
      </el-col>
      <el-col :span="20">
        <div class="grid-content bg-purple-dark">
          <el-container>
            <el-main>
              <template>
                <!-- 加载还款信息表 -->
                <el-table :data="repayList"  style="width: 100%">
                  <el-table-column prop="debitId" label="借款表单编号" width="105">
                  </el-table-column>

                  <el-table-column
                    prop="contractId"
                    label="合同签订ID"
                    width="105"
                  >
                </el-table-column>
                  <el-table-column
                    prop="userId"
                    label="申请人id"
                    width="105"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="debitStatus"
                    label="审核状态"
                    width="105"
                  >
                  </el-table-column>
  
                  <el-table-column
                    prop="debitRequestLimit"
                    label="申请金额"
                    width="105"
                  >
                  </el-table-column>
  
                  <el-table-column
                    prop="debitApproveLimit"
                    label="借款审批额度"
                    width="105"
                  >
                  </el-table-column>
                 
  
                  <el-table-column
                    prop="debitSumExpires"
                    label="还款总期数"
                    width="105"
                  >
                  </el-table-column>
      
                  <el-table-column prop="operation1" label="操作" width="110">
                      <template slot-scope="scope" >
                      <el-button
                        type="primary"
                        round
                        size="mini"
                        style="width: 100px"
                        @click="toUserInfos(scope.row.userId,scope.row.debitId)"
                        >个人信息查看
                        </el-button >
                       </template>
  
                  </el-table-column>
  
                 
                </el-table>
              </template>
            </el-main>
          </el-container>
        </div>
      </el-col>
      <el-col :span="2">
        <div class="grid-content bg-purple-dark">&emsp;</div>
      </el-col>
    </el-row>
  </template>
  
  <script>
  
  export default {
    data() {
      return {
        seen1:true,
        userAndPage: {
          //传给后端的值
          userId: "",
          currentPage: 1,
          debitStatus: 10,
          pageSize: 20,
        },
        repayList: [], //还款列表
        topInfo: {
          contractNo: 1,
          repayPayable: 1,
          totalRepayAlready: 1,
        },
        statusNumber:10,
        page: {
          pageSizes: [2, 5, 10],
          total: 0,
        },
        query: {
          currentPage: 1,
          pageSize: 2,
          realName: "",
          dateRange: [],
        },
        userinfo:{
          userinfoId:0,
        }
  
        
      };
    },
  
    methods: {
  
      //加载当前用户的借款申请表
      loadDebitList() {
        this.$axios.post("/debit/find",this.userAndPage).then((res) => {
          if (res.data.code == 200) {
            this.repayList = res.data.data.pageInfo.list;
          } else {
            this.$message.error("操作错误");
          }
        });
      },
  
      //信息审核
      toUserInfos(userId,debitId) {
        localStorage.setItem("debitId",debitId);
        this.userinfo.userId  = userId;
        //将用户id改编为详情表id
        this.$axios.post("/userinfo/getuserinfoidbyuserid",this.userinfo).then((res) => {
          if (res.data.code == 200) {
            this.userinfo.userinfoId = res.data.data.userinfo.userinfoId;
            localStorage.setItem("userinfoId",this.userinfo.userinfoId);
            console.log("测试数据"+localStorage.getItem("userinfoId"));
          } 
        });
        this.$router.push("/AdminUseXIN");
      },
    
    },
  
    mounted() {
      console.log("查询全部借款信息");
      this.loadDebitList();
    },
   
    beforeDestroy() {
      EventBus.$emit("aaa", 1);
    },
  };
  </script>
  <style >
  .succbutton {
      margin: 10px auto;
      margin-left: 60px;
  }
  
  </style>
  